package com.fwtai.web;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

/**
 * 轮播图访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2022-06-01 16:02:15
 * @QQ号码 444141300
 * @Email service@yinlz.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class CarouselDao{

  private final DaoHandle dao;

  public CarouselDao(final DaoHandle dao){
    this.dao = dao;
  }

  public int add(final PageFormData formData){
    return dao.execute("carousel.add",formData);
  }

  public Long queryExistById(final Long kid){
    return dao.queryForLong("carousel.queryExistById",kid);
  }

  public int edit(final PageFormData formData){
    return dao.execute("carousel.edit",formData);
  }

  public HashMap<String,Object> queryById(final Long kid){
    return dao.queryForHashMap("carousel.queryById",kid);
  }

  public int delById(final Long kid){
    return dao.execute("carousel.delById",kid);
  }

  public String getFilePath(final Long kid){
    return dao.queryForString("carousel.getFilePath",kid);
  }

  public int delData(final Long kid){
    return dao.execute("carousel.delData",kid);
  }

  public int editEnable(final Long kid){
    return dao.execute("carousel.editEnable",kid);
  }

  public int delByKeys(final long[] list){
    return dao.execute("carousel.delByKeys",list);
  }

  public HashMap<String,Object> listData(final PageFormData formData){
    return dao.queryForPage(formData,"carousel.listData","carousel.listTotal");
  }

  public List<Object> getListData(final PageFormData formData){
    return dao.queryListEntity("carousel.listData",formData);
  }

  public Integer listTotal(final PageFormData formData){
    return dao.queryForInteger("carousel.listTotal",formData);
  }
}